/**
 * 
 */
package business;

import java.util.ArrayList;

import model.Etudiant;
import dbAccess.EtudiantDBAccess;
import exceptions.*;

/**
 * @author Anthares & Hennek
 *
 */
public class EtudiantManager {
	private EtudiantDBAccess edba = new EtudiantDBAccess();
	public ArrayList<Etudiant> getEtudiant(int annee, int section_id) throws PasIdentificationException, DatabaseErrorException, InvalidDataException{
		if(annee>3 || annee<0 || section_id<0) throw new InvalidDataException();
		return edba.getEtudiant(annee, section_id);
	}
	
	public int addEtudiant(Etudiant etu) throws PasIdentificationException, DatabaseErrorException, EmptyFormException{
		if(etu.getNom() == null || etu.getPrenom() == null) throw new EmptyFormException();
		return edba.addEtudiant(etu);
	}
	
	public void modifEtudiant(Etudiant etu) throws PasIdentificationException, DatabaseErrorException, EmptyFormException{
		if(etu.getNom() == null || etu.getPrenom() == null) throw new EmptyFormException();
		edba.modifEtudiant(etu);
	}
}
